package com.dormitory.javadormitory.mapper;

import com.dormitory.javadormitory.entity.Bunkhouse;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface ArticleManageMapper {

    @Select("select * from bunkhouse")
    ArrayList<Bunkhouse> bunkhouseAll();

    @Select("select * from bunkhouse where id = #{id}")
    Bunkhouse inquireId(int id);

    @Update("UPDATE bunkhouse set bunkhouseName = #{bunkhouse.bunkhouseName},issue = #{bunkhouse.issue} where id = #{bunkhouse.id}")
    void editId(@Param("bunkhouse") Bunkhouse bunkhouse);

    @Select("select * from bunkhouse where bunkhouseName = #{bunkhouseName}")
    ArrayList<Bunkhouse> bunkhouseName(String bunkhouseName);

    @Insert("insert into bunkhouse (bunkhouseName, issue) values (#{bunkhouse.bunkhouseName},#{bunkhouse.issue})")
    void problemInput(@Param("bunkhouse") Bunkhouse bunkhouse);

    @Delete("delete from bunkhouse where id=#{id}")
    void deleteBunkhouse1(int id);

}
